<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改旅游资讯信息')" />
    <th:block th:include="include :: summernote-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-info-edit" th:object="${spotInfo}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label">旅游资讯标题：</label>
                <div class="col-sm-8">
                    <input name="title" th:field="*{title}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">资讯首页大图：</label>
                <div class="col-sm-8">
                    <input id="infoPic" name="infoPic"  onclick="uploadTupian()" type="text" th:field="*{infoPic}"  readonly="true" >
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">旅游资讯内容：</label>
                <div class="col-sm-8">
                    <input id="content" name="content" th:field="*{content}"  type="hidden">
                    <div id="editor" class="summernote"></div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: summernote-js" />
    <script type="text/javascript">
        var prefix = ctx + "lvyou/info";
        $("#form-info-edit").validate({
            focusCleanup: true
        });

        $(document).ready(function () {
            $('.summernote').summernote({
                lang: 'zh-CN'
            });
            var content = $("#content").val();
            $('#editor').summernote('code', content);
        });

        function uploadTupian() {
            var options = {
                title: '旅游资讯图片上传',
                width: "800",
                height:$(window).height() - 50,
                url: ctx+"lvyou/spot" + "/uploadTupian",
                callBack: doSubmit2
            };
            $.modal.openOptions(options);
        }

        function doSubmit2(index, layero){
            var body = layer.getChildFrame('body', index);
            $("#infoPic").val(body.find('#spotPic').val());  //搜索名称
            layer.close(index);
        }

        function submitHandler() {
            if ($.validate.form()) {
                var html=$('#editor').summernote('code');
                $("#content").val(html);
                $.operate.save(prefix + "/edit", $('#form-info-edit').serialize());
            }
        }
    </script>
</body>
</html>